package com.hxit.contorller;


import com.hxit.pojo.Knowledgebase;
import com.hxit.pojo.Result;
import com.hxit.servics.KnowledgebaseService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

    @RestController
    @Slf4j
    public class KnowledgebaseController {
        @Autowired
        private KnowledgebaseService knowledgebaseService;
        //新增Knowledgebase方法
        @PostMapping("/AddKnowledgebases")
        public Result AddKnowledgebases(@RequestBody Knowledgebase knowledgebase){
            knowledgebaseService.AddKnowledgebases(knowledgebase);
            log.info("新增knowledgebase");
            return Result.success();
        }
        //删除Knowledgebase方法
        @DeleteMapping("/DeleteKnowledgebasesById/{ids}")
        public Result DeleteKnowledgebaseById(@PathVariable List<Integer> ids){
            log.info("删除knowledgebase模型");
            knowledgebaseService.DeleteKnowledgebasesById(ids);
            return Result.success();
        }
        //根据id查询知识信息方法
        @GetMapping("/FindKnowledgebaseById/{id}")
        public  Result FindKnowledgebaseById(@PathVariable Integer id){
            Knowledgebase knowledgebase=knowledgebaseService.FindKnowledgebaseById(id);
            log.info("根据id查知识信息{}",knowledgebase);
            return Result.success(knowledgebase);
        }
        //修改Knowledgebase方法
        @PutMapping("/UpdateKnowledgebases")
        public  Result UpdateKnowledgebases(@RequestBody Knowledgebase knowledgebase){
            knowledgebaseService.UpdateKnowledgebases(knowledgebase);
            log.info("更新knowledgebases");
            return Result.success();
        }
}
